package 方法;

public class MyThread1 implements Runnable {

	@Override
	public void run() {
          //采用同步线程代码块保证安全
		synchronized (this) {
			System.out.println(Thread.currentThread().getName()+"---------开始");
			
			try {
				wait();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			System.out.println(Thread.currentThread().getName()+"---------结束");
			
			
			
		}
	}

}
